import { createRouter, createWebHistory } from 'vue-router'
// import store from '@/store'
// import { getStorage } from '@/utils/storage'

const routes = [
  {
    path: "/",
    name: "main",
    component: () => import('@/views/main/Index.vue'),
    redirect: '/home',
    children: [
      {
        path: '/home',
        name: 'main-home',
        component: () => import('@/views/main/Home.vue')
      }
    ]
  },
  {
    path: "/svg",
    name: "svg",
    component: () => import("@/views/svg.vue"),
  },
  // {
  //   path: '/',
  //   name: 'dimension',
  //   component: () => import('@/views/dimension/Main.vue'),
  //   redirect: '/',
  //   children: [{
  //     path: '/',
  //     name: 'Index',
  //     component: () => import('@/views/dimension/Index.vue')
  //   }
  //   ]
  // }
];

const router = createRouter({
  history: createWebHistory(),
  base: import.meta.env.BASE_URL,
  routes,
});


// const user = getStorage('user') || {}
// router.beforeEach((to, from, next) => {
//   if (user.token) {
//     store.state.user = user
//     next();
//   } else {
//     if (to.path === '/login') {
//       next();
//     } else {
//       next({ path: '/login' })
//     }
//   }
// });

export default router;
